<html>
<head><meta charset="utf-8"><title>Test Suites · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Test.20Suites.html">Test Suites</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="215551362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Test%20Suites/near/215551362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> aesteve <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Test.20Suites.html#215551362">(Nov 04 2020 at 08:15)</a>:</h4>
<p>Hi everyone, hope you're doing well.<br>
I'm facing a design issues with testing, especially "high-level" testing (almost integration testing).<br>
I'm testing a component heavily relying on databases / pub/sub systems (moving data from one to another).<br>
I'm heavily relying on TestContainers-rs to do so (and its working marvelously tbh, kudos).<br>
Problem is, setting a database and/or pub/sub docker-compose up for every test is quite heavy, and not really necessary. Once the infrastructure is set up, I can run different tests, clean-up data if required in between such tests.<br>
This looks like a bit like "test suite": </p>
<ul>
<li>before_all =&gt; set-up an infrastructure, </li>
<li>
<p>after_all: clean and shut_down<br>
In between, tests can run sequentially: </p>
</li>
<li>
<p>insert some data, check it's received and published to another system</p>
</li>
<li>clean-up the DB</li>
<li>perform another tests<br>
This obviously break test parallelism, etc. <br>
For now the only workaround I found is putting everything in a single test function. It works, but is quite obnoxious.<br>
Would anyone have any recommendation, pointer, or just some part of the docs I missed to tackle this properly?<br>
Thanks a lot.</li>
</ul>



<a name="215551601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Test%20Suites/near/215551601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Test.20Suites.html#215551601">(Nov 04 2020 at 08:19)</a>:</h4>
<p>this is not built-in to libtest</p>



<a name="215551610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Test%20Suites/near/215551610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Test.20Suites.html#215551610">(Nov 04 2020 at 08:19)</a>:</h4>
<p>there might be a library on <a href="http://crates.io">crates.io</a> for it</p>



<a name="215551885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Test%20Suites/near/215551885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> aesteve <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Test.20Suites.html#215551885">(Nov 04 2020 at 08:22)</a>:</h4>
<p>That's what I was wondering. It sounds completely normal that the built-in libtest doesn't handle this. It's definitely an edge-case.<br>
But I could'nt find any crate allowing this. I'm guessing "test suite" is probably not the right keyword though :(</p>



<a name="215552208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Test%20Suites/near/215552208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Test.20Suites.html#215552208">(Nov 04 2020 at 08:27)</a>:</h4>
<p>'test framework' maybe</p>



<a name="215552709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/Test%20Suites/near/215552709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> aesteve <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/Test.20Suites.html#215552709">(Nov 04 2020 at 08:33)</a>:</h4>
<p>Thanks! I feel like <a href="https://lib.rs/crates/serial_test">https://lib.rs/crates/serial_test</a> may help.<br>
One problem though is that the "container" must live throughout the whole test set (and not be dropped once the first function ends)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>